home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / PPCToolBox.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  11.0 KB  |  388 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Sunday, January 6, 1991 at 10:55 PM
  3.     PPCToolBox.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc.    1989-1990
  7.         All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT PPCToolBox;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingPPCToolBox}
  21. {$SETC UsingPPCToolBox := 1}
  22.  
  23. {$I+}
  24. {$SETC PPCToolBoxIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingAppleTalk}
  27. {$I $$Shell(PInterfaces)AppleTalk.p}
  28. {$ENDC}
  29. {$IFC UNDEFINED UsingMemory}
  30. {$I $$Shell(PInterfaces)Memory.p}
  31. {$ENDC}
  32. {$IFC UNDEFINED UsingTypes}
  33. {$I $$Shell(PInterfaces)Types.p}
  34. {$ENDC}
  35. {$SETC UsingIncludes := PPCToolBoxIncludes}
  36.  
  37. TYPE
  38. PPCServiceType = SignedByte;
  39.  
  40. CONST
  41.  
  42. {  service Type  }
  43. ppcServiceRealTime = 1;
  44.  
  45. TYPE
  46. PPCLocationKind = INTEGER;
  47.  
  48. CONST
  49.  
  50. { lookup Type }
  51. ppcNoLocation = 0;                          { There is no PPCLocName }
  52. ppcNBPLocation = 1;                         { Use AppleTalk NBP      }
  53. ppcNBPTypeLocation = 2;                     { Used for specifying a location name type during PPCOpen only }
  54.  
  55. TYPE
  56. PPCPortKinds = INTEGER;
  57.  
  58. CONST
  59.  
  60. { port Types }
  61.  
  62. ppcByCreatorAndType = 1;                    { PortType is specified as colloquial Mac creator and type }
  63. ppcByString = 2;                            { Port Type is in pascal string format }
  64.  
  65. TYPE
  66. PPCSessionOrigin = SignedByte;              { Values returned for request field in PPCInform call }
  67.  
  68. CONST
  69.  
  70. { Values returned for requestType field in PPCInform call }
  71. ppcLocalOrigin = 1;                         { session originated from this machine }
  72. ppcRemoteOrigin = 2;                        { session originated from remote machine }
  73.  
  74. TYPE
  75. PPCPortRefNum = INTEGER;
  76. PPCSessRefNum = LONGINT;
  77.  
  78. PPCPortPtr = ^PPCPortRec;
  79. PPCPortRec = RECORD
  80.     nameScript: ScriptCode;                 { script of name }
  81.     name: Str32;                            { name of port as seen in browser }
  82.     portKindSelector: PPCPortKinds;         { which variant }
  83.     CASE PPCPortKinds OF
  84.       ppcByString:
  85.         (portTypeStr: Str32);
  86.       ppcByCreatorAndType:
  87.         (portCreator: OSType;
  88.         portType: OSType);
  89.     END;
  90.  
  91. LocationNamePtr = ^LocationNameRec;
  92. LocationNameRec = RECORD
  93.     locationKindSelector: PPCLocationKind;  { which variant }
  94.     CASE PPCLocationKind OF
  95.       ppcNBPLocation:
  96.         (nbpEntity: EntityName);            { NBP name entity }
  97.       ppcNBPTypeLocation:
  98.         (nbpType: Str32);                   { just the NBP type string, for PPCOpen }
  99.     END;
  100.  
  101. PortInfoPtr = ^PortInfoRec;
  102. PortInfoRec = RECORD
  103.     filler1: SignedByte;
  104.     authRequired: BOOLEAN;
  105.     name: PPCPortRec;
  106.     END;
  107.  
  108.  
  109. PortInfoArrayPtr = ^PortInfoArray;
  110. PortInfoArray = ARRAY [0..0] OF PortInfoRec;
  111. PPCFilterProcPtr = ProcPtr;
  112. {Procedures you will need to write 
  113.  ex: void MyCompletionRoutine(PPCParamBlkPtr pb) 
  114.  ex: pascal Boolean    MyPortFilter(LocationNamePtr locationName, PortInfoPtr 
  115.  thePortInfo)}
  116.  
  117. PPCCompProcPtr = ProcPtr;
  118.  
  119. PPCOpenPBPtr = ^PPCOpenPBRec;
  120. PPCOpenPBRec = RECORD
  121.     qLink: Ptr;
  122.     csCode: INTEGER;
  123.     intUse: INTEGER;
  124.     intUsePtr: Ptr;
  125.     ioCompletion: PPCCompProcPtr;
  126.     ioResult: OSErr;
  127.     reserved: ARRAY [1..5] OF LONGINT;      { reserved }
  128.     portRefNum: PPCPortRefNum;              { Port Reference }
  129.     filler1: LONGINT;
  130.     serviceType: PPCServiceType;
  131.     resFlag: SignedByte ;
  132.     portName: PPCPortPtr;                   { PortName for PPC }
  133.     locationName: LocationNamePtr;
  134.     networkVisible: BOOLEAN;
  135.     nbpRegistered: BOOLEAN;
  136.     END;
  137.  
  138. PPCInformPBPtr = ^PPCInformPBRec;
  139. PPCInformPBRec = RECORD
  140.     qLink: Ptr;
  141.     csCode: INTEGER;
  142.     intUse: INTEGER;
  143.     intUsePtr: Ptr;
  144.     ioCompletion: PPCCompProcPtr;
  145.     ioResult: OSErr;
  146.     reserved: ARRAY [1..5] OF LONGINT;
  147.     portRefNum: PPCPortRefNum;
  148.     sessRefNum: PPCSessRefNum;
  149.     serviceType: PPCServiceType;
  150.     autoAccept: BOOLEAN;
  151.     portName: PPCPortPtr;
  152.     locationName: LocationNamePtr;
  153.     userName: StringPtr;
  154.     userData: LONGINT;
  155.     requestType: PPCSessionOrigin;
  156.     END;
  157.  
  158. PPCStartPBPtr = ^PPCStartPBRec;
  159. PPCStartPBRec = RECORD
  160.     qLink: Ptr;
  161.     csCode: INTEGER;
  162.     intUse: INTEGER;
  163.     intUsePtr: Ptr;
  164.     ioCompletion: PPCCompProcPtr;
  165.     ioResult: OSErr;
  166.     reserved: ARRAY [1..5] OF LONGINT;
  167.     portRefNum: PPCPortRefNum;
  168.     sessRefNum: PPCSessRefNum;
  169.     serviceType: PPCServiceType;
  170.     resFlag: SignedByte;
  171.     portName: PPCPortPtr;
  172.     locationName: LocationNamePtr;
  173.     rejectInfo: LONGINT;
  174.     userData: LONGINT;
  175.     userRefNum: LONGINT;
  176.     END;
  177.  
  178. PPCAcceptPBPtr = ^PPCAcceptPBRec;
  179. PPCAcceptPBRec = RECORD
  180.     qLink: Ptr;
  181.     csCode: INTEGER;
  182.     intUse: INTEGER;
  183.     intUsePtr: Ptr;
  184.     ioCompletion: PPCCompProcPtr;
  185.     ioResult: OSErr;
  186.     reserved: ARRAY [1..5] OF LONGINT;
  187.     filler1: INTEGER;
  188.     sessRefNum: PPCSessRefNum;
  189.     END;
  190.  
  191. PPCRejectPBPtr = ^PPCRejectPBRec;
  192. PPCRejectPBRec = RECORD
  193.     qLink: Ptr;
  194.     csCode: INTEGER;
  195.     intUse: INTEGER;
  196.     intUsePtr: Ptr;
  197.     ioCompletion: PPCCompProcPtr;
  198.     ioResult: OSErr;
  199.     reserved: ARRAY [1..5] OF LONGINT;
  200.     filler1: INTEGER;
  201.     sessRefNum: PPCSessRefNum;
  202.     filler2: INTEGER;
  203.     filler3: LONGINT;
  204.     filler4: LONGINT;
  205.     rejectInfo: LONGINT;
  206.     END;
  207.  
  208. PPCWritePBPtr = ^PPCWritePBRec;
  209. PPCWritePBRec = RECORD
  210.     qLink: Ptr;
  211.     csCode: INTEGER;
  212.     intUse: INTEGER;
  213.     intUsePtr: Ptr;
  214.     ioCompletion: PPCCompProcPtr;
  215.     ioResult: OSErr;
  216.     reserved: ARRAY [1..5] OF LONGINT;
  217.     filler1: INTEGER;
  218.     sessRefNum: PPCSessRefNum;
  219.     bufferLength: Size;
  220.     actualLength: Size;
  221.     bufferPtr: Ptr;
  222.     more: BOOLEAN;
  223.     filler2: SignedByte;
  224.     userData: LONGINT;
  225.     blockCreator: OSType;
  226.     blockType: OSType;
  227.     END;
  228.  
  229. PPCReadPBPtr = ^PPCReadPBRec;
  230. PPCReadPBRec = RECORD
  231.     qLink: Ptr;
  232.     csCode: INTEGER;
  233.     intUse: INTEGER;
  234.     intUsePtr: Ptr;
  235.     ioCompletion: PPCCompProcPtr;
  236.     ioResult: OSErr;
  237.     reserved: ARRAY [1..5] OF LONGINT;
  238.     filler1: INTEGER;
  239.     sessRefNum: PPCSessRefNum;
  240.     bufferLength: Size;
  241.     actualLength: Size;
  242.     bufferPtr: Ptr;
  243.     more: BOOLEAN;
  244.     filler2: SignedByte;
  245.     userData: LONGINT;
  246.     blockCreator: OSType;
  247.     blockType: OSType;
  248.     END;
  249.  
  250. PPCEndPBPtr = ^PPCEndPBRec;
  251. PPCEndPBRec = RECORD
  252.     qLink: Ptr;
  253.     csCode: INTEGER;
  254.     intUse: INTEGER;
  255.     intUsePtr: Ptr;
  256.     ioCompletion: PPCCompProcPtr;
  257.     ioResult: OSErr;
  258.     reserved: ARRAY [1..5] OF LONGINT;
  259.     filler1: INTEGER;
  260.     sessRefNum: PPCSessRefNum;
  261.     END;
  262.  
  263. PPCClosePBPtr = ^PPCClosePBRec;
  264. PPCClosePBRec = RECORD
  265.     qLink: Ptr;
  266.     csCode: INTEGER;
  267.     intUse: INTEGER;
  268.     intUsePtr: Ptr;
  269.     ioCompletion: PPCCompProcPtr;
  270.     ioResult: OSErr;
  271.     reserved: ARRAY [1..5] OF LONGINT;
  272.     portRefNum: PPCPortRefNum;
  273.     END;
  274.  
  275. IPCListPortsPBPtr = ^IPCListPortsPBRec;
  276. IPCListPortsPBRec = RECORD
  277.     qLink: Ptr;
  278.     csCode: INTEGER;
  279.     intUse: INTEGER;
  280.     intUsePtr: Ptr;
  281.     ioCompletion: PPCCompProcPtr;
  282.     ioResult: OSErr;
  283.     reserved: ARRAY [1..5] OF LONGINT;
  284.     filler1: INTEGER;
  285.     startIndex: INTEGER;
  286.     requestCount: INTEGER;
  287.     actualCount: INTEGER;
  288.     portName: PPCPortPtr;
  289.     locationName: LocationNamePtr;
  290.     bufferPtr: PortInfoArrayPtr;
  291.     END;
  292.  
  293.     PPCParamBlockPtr = ^PPCParamBlockRec;
  294.     PPCParamBlockRec = RECORD
  295.                         CASE Integer OF
  296.                             0: (openParam:         PPCOpenPBRec);
  297.                             1: (informParam:    PPCInformPBRec);
  298.                             2: (startParam:        PPCStartPBRec);
  299.                             3: (acceptParam:    PPCAcceptPBRec);
  300.                             4: (rejectParam:    PPCRejectPBRec);
  301.                             5: (writeParam:        PPCWritePBRec);
  302.                             6: (readParam:         PPCReadPBRec);
  303.                             7: (endParam:        PPCEndPBRec);
  304.                             8: (closeParam:        PPCClosePBRec);
  305.                             9: (listPortsParam: IPCListPortsPBRec);
  306.                     END;
  307.  
  308.  
  309.  
  310. {  PPC Calling Conventions  }
  311. FUNCTION PPCInit: OSErr;
  312.     INLINE $7000,$A0DD,$3E80;
  313. FUNCTION PPCOpen(pb: PPCOpenPBPtr;async: BOOLEAN): OSErr;
  314. FUNCTION PPCOpenSync(pb: PPCOpenPBPtr): OSErr;
  315.     INLINE $205F,$7001,$A0DD,$3E80;
  316. FUNCTION PPCOpenAsync(pb: PPCOpenPBPtr): OSErr;
  317.     INLINE $205F,$7001,$A4DD,$3E80;
  318. FUNCTION PPCInform(pb: PPCInformPBPtr;async: BOOLEAN): OSErr;
  319. FUNCTION PPCInformSync(pb: PPCInformPBPtr): OSErr;
  320.     INLINE $205F,$7003,$A0DD,$3E80;
  321. FUNCTION PPCInformAsync(pb: PPCInformPBPtr): OSErr;
  322.     INLINE $205F,$7003,$A4DD,$3E80;
  323. FUNCTION PPCStart(pb: PPCStartPBPtr;async: BOOLEAN): OSErr;
  324. FUNCTION PPCStartSync(pb: PPCStartPBPtr): OSErr;
  325.     INLINE $205F,$7002,$A0DD,$3E80;
  326. FUNCTION PPCStartAsync(pb: PPCStartPBPtr): OSErr;
  327.     INLINE $205F,$7002,$A4DD,$3E80;
  328. FUNCTION PPCAccept(pb: PPCAcceptPBPtr;async: BOOLEAN): OSErr;
  329. FUNCTION PPCAcceptSync(pb: PPCAcceptPBPtr): OSErr;
  330.     INLINE $205F,$7004,$A0DD,$3E80;
  331. FUNCTION PPCAcceptAsync(pb: PPCAcceptPBPtr): OSErr;
  332.     INLINE $205F,$7004,$A4DD,$3E80;
  333. FUNCTION PPCReject(pb: PPCRejectPBPtr;async: BOOLEAN): OSErr;
  334. FUNCTION PPCRejectSync(pb: PPCRejectPBPtr): OSErr;
  335.     INLINE $205F,$7005,$A0DD,$3E80;
  336. FUNCTION PPCRejectAsync(pb: PPCRejectPBPtr): OSErr;
  337.     INLINE $205F,$7005,$A4DD,$3E80;
  338. FUNCTION PPCWrite(pb: PPCWritePBPtr;async: BOOLEAN): OSErr;
  339. FUNCTION PPCWriteSync(pb: PPCWritePBPtr): OSErr;
  340.     INLINE $205F,$7006,$A0DD,$3E80;
  341. FUNCTION PPCWriteAsync(pb: PPCWritePBPtr): OSErr;
  342.     INLINE $205F,$7006,$A4DD,$3E80;
  343. FUNCTION PPCRead(pb: PPCReadPBPtr;async: BOOLEAN): OSErr;
  344. FUNCTION PPCReadSync(pb: PPCReadPBPtr): OSErr;
  345.     INLINE $205F,$7007,$A0DD,$3E80;
  346. FUNCTION PPCReadAsync(pb: PPCReadPBPtr): OSErr;
  347.     INLINE $205F,$7007,$A4DD,$3E80;
  348. FUNCTION PPCEnd(pb: PPCEndPBPtr;async: BOOLEAN): OSErr;
  349. FUNCTION PPCEndSync(pb: PPCEndPBPtr): OSErr;
  350.     INLINE $205F,$7008,$A0DD,$3E80;
  351. FUNCTION PPCEndAsync(pb: PPCEndPBPtr): OSErr;
  352.     INLINE $205F,$7008,$A4DD,$3E80;
  353. FUNCTION PPCClose(pb: PPCClosePBPtr;async: BOOLEAN): OSErr;
  354. FUNCTION PPCCloseSync(pb: PPCClosePBPtr): OSErr;
  355.     INLINE $205F,$7009,$A0DD,$3E80;
  356. FUNCTION PPCCloseAsync(pb: PPCClosePBPtr): OSErr;
  357.     INLINE $205F,$7009,$A4DD,$3E80;
  358. FUNCTION IPCListPorts(pb: IPCListPortsPBPtr;async: BOOLEAN): OSErr;
  359. FUNCTION IPCListPortsSync(pb: IPCListPortsPBPtr): OSErr;
  360.     INLINE $205F,$700A,$A0DD,$3E80;
  361. FUNCTION IPCListPortsAsync(pb: IPCListPortsPBPtr): OSErr;
  362.     INLINE $205F,$700A,$A4DD,$3E80;
  363. FUNCTION DeleteUserIdentity(userRef: LONGINT): OSErr;
  364. FUNCTION GetDefaultUser(VAR userRef: LONGINT;
  365.                         VAR userName: Str32): OSErr;
  366. FUNCTION StartSecureSession(pb: PPCStartPBPtr;
  367.                             VAR userName: Str32;
  368.                             useDefault: BOOLEAN;
  369.                             allowGuest: BOOLEAN;
  370.                             VAR guestSelected: BOOLEAN;
  371.                             prompt: Str255): OSErr;
  372. FUNCTION PPCBrowser(prompt: Str255;
  373.                     applListLabel: Str255;
  374.                     defaultSpecified: BOOLEAN;
  375.                     VAR theLocation: LocationNameRec;
  376.                     VAR thePortInfo: PortInfoRec;
  377.                     portFilter: PPCFilterProcPtr;
  378.                     theLocNBPType: Str32): OSErr;
  379.     INLINE $303C,$0D00,$A82B;
  380.  
  381.  
  382. {$ENDC}    { UsingPPCToolBox }
  383.  
  384. {$IFC NOT UsingIncludes}
  385.     END.
  386. {$ENDC}
  387.  
  388.